home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 January: Mac OS SDK / Dev.CD Jan 96 SDK / Dev.CD Jan 96 SDK1.toast / Development Kits (Disc 1) / AppleScript / Development Tools / Sample Code / 7Edit / C Sources / SVEditGlobals.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-25  |  5.8 KB  |  240 lines  |  [TEXT/MPS ]

  1. /*
  2.     SVEditGlobals.h
  3.     
  4.     Version 3.0d9
  5.     
  6.     Copyright © SRL Data 1992, 1993
  7.     
  8.     All rights reserved
  9.     
  10.     Produced by : SRL Data
  11.     Originally Developed for UK.DTS
  12. */
  13.  
  14.  
  15. /* 
  16.     Global data structures, variables and constants for
  17.     the 7Edit example program.
  18. */
  19.  
  20. /** This example is brought to you for the purposes of exploration and experimentation of
  21.     System 7.0.  It is not intended to form the basis of your own programs - but try out
  22.     the code - that's what it's there for **/
  23.  
  24. /*
  25.     About the data structures-
  26.     SectRecord -:
  27.     this is our own record type used for holding specific information about Publisher
  28.     or Subscriber sections.  A linked list of SectHandles is referenced from the document
  29.     record.  A SectHandle is stored in the refcon field of the Edition Manager section record- the
  30.     same idea as hooking up the document record to the refcon of the WindowRecord.
  31.     
  32.     DocRec -:
  33.     This is used for storing document records containing Font, Size and Style information.
  34.     
  35.     HeaderRec -:
  36.     This is then stored as a 'TFSS' resource (standing for Text Font, Size and Style) which is
  37.     stored in the resource fork of a document file.  It also now includes stuff for storing
  38.     the number of sections in a document and the lastsectionID
  39.  
  40.     New for 3.0d2 :
  41.     
  42.     27-Feb-92 : NH : Add comment, zap test menu stuff, 
  43.                      remove unneeded constants, 
  44.                      move others to SVEditWindow.p, zap gCurrSection
  45.                      
  46.     Changes for 3.0d4 :
  47.     
  48.      3-Jul-92 : NH : Remove kAEAskUser
  49.                      Remove kAEYes,kAENo - now in AERegistry.h
  50.      5-Aug-92 : NH : Added SVEditAppSig, gNewDocCount
  51.  
  52.     Changes for 3.0d6 :
  53.     
  54.      9-Sep-92 : JL : Added gRecordingImplemented flag
  55.      
  56. */
  57.  
  58. #ifndef __SVEDITGLOBALS__
  59. #define __SVEDITGLOBALS__
  60.  
  61. #include <Types.h>
  62. #include <Quickdraw.h>
  63. #include <Menus.h>
  64. #include <Editions.h>
  65. #include <Printing.h>
  66.  
  67. #define  SVEditAppSig 'SVED'
  68.  
  69. #define  WindowID     128
  70. #define  ErrorAlert   256
  71. #define  AdviseAlert  257
  72.  
  73. /*
  74.     Menu Resource IDs
  75. */
  76.   
  77. #define  appleID    128
  78. #define  fileID        129
  79. #define  editID        130
  80. #define  mfontID    131
  81. #define     sizeID        132
  82. #define  styleID    133
  83.   
  84. #define  kLastID    styleID
  85.  
  86. /*
  87.     Items in Apple Menu
  88. */
  89.   
  90. #define  aboutItem  1
  91.   
  92. /*
  93.     Items in File Menu
  94. */
  95.   
  96. #define  fmNew                  1
  97. #define  fmOpen              2
  98. #define  fmClose              4
  99. #define  fmSave              5
  100. #define  fmSaveAs              6
  101. #define  fmRevert              7
  102. #define  fmPageSetUp          9
  103. #define  fmPrint              10
  104. #define  fmQuit              12
  105.   
  106. /*
  107.     Items in Edit Menu
  108. */
  109. #define  undoCommand              1
  110. #define  cutCommand              3
  111. #define  copyCommand              4
  112. #define  pasteCommand              5
  113. #define  clearCommand              6
  114. #define  selectAllCommand          7
  115.   
  116. #define  cPublisher                9
  117. #define  cSubscriber               10
  118. #define  cOptions                  11
  119. #define  cBorders                  12
  120.  
  121. /*
  122.     Items in Style Menu
  123. */
  124.  
  125. #define  cPlain              1
  126. #define  cBold                  2
  127. #define  cItalic             3
  128. #define  cUnderline         4
  129. #define  cOutline             5
  130. #define  cShadow             6
  131. #define  cCondense              7
  132. #define  cExtend             8
  133.  
  134. /*
  135.     Entry of Menu in myMenus
  136. */
  137. #define  appleM         0
  138. #define  fileM              1
  139. #define  editM              2
  140. #define  fontM              3
  141. #define  sizeM              4
  142. #define  styleM         5
  143. #define  kLastMenu        5
  144.  
  145. /*
  146.     Save Changes Dialog Items
  147. */
  148.   
  149. #define  aaSave              1
  150. #define  aaDiscard              2
  151. #define  aaCancel              3
  152.  
  153. #define  kOSEvent               app4Evt        /*event used by MultiFinder*/
  154. #define  kSuspendResumeMessage         1        /*high byte of suspend/resume event message*/
  155. #define  kResumeMask                 1        /*bit of message field for resume vs. suspend*/
  156. #define  kMouseMovedMessage          0xFA        /*high byte of mouse-moved event message*/
  157. #define  kNoEvents                     0        /*no events mask*/
  158.   
  159. /*
  160.     this is a section record to hold the information about 
  161.     the publishers and subscribers in this document
  162. */  
  163.  
  164. struct SectRec {
  165.     SectionHandle   fSectHandle;
  166.     short           fSectionID;
  167.     RgnHandle       fBorderRgn; /*handle to the outside border*/
  168.     Rect            fInnerBounds;
  169.     short           fStart;     /*fStart and fEnd are both specific to a*/
  170.     short           fEnd;       /*text handling application- start and end of text selection*/
  171.     struct SectRec  **fNextSection;
  172.     FSSpec          fFSSpec;
  173.     short           fCount;
  174.     Handle          fTextHandle;
  175.     Boolean         fChanged; /*has the section been changed*/
  176.     struct DocRec   *fDocument;
  177.  };                          
  178.  
  179. typedef struct SectRec SectRec;
  180. typedef SectRec *SectPtr, **SectHandle;
  181.  
  182. struct DocRec {
  183.   TEHandle         theText;
  184.   ControlHandle    vScrollBar;
  185.   ControlHandle    hScrollBar;
  186.   WindowPtr        theWindow;
  187.   Boolean          dirty;
  188.   short            refNum;
  189.   short            theFont;
  190.   short            theSize;
  191.   Style            theStyle;
  192.   Str255           theFileName;
  193.   SectHandle       firstSection; /*the first section in the list*/
  194.   SectHandle       lastSection;  /*the last section*/
  195.   short            numSections;
  196.   FSSpec           theFSSpec;
  197.   short            lastID;      /*the last sectionID*/
  198.   THPrint          thePrintSetup;
  199.   Rect             pageSize;    /*From thePrintSetUp^^.prInfo.rPage but 0 offset*/
  200.   Boolean             showBorders;
  201.   Boolean          everSaved;
  202. };
  203.  
  204. typedef struct DocRec DocRec;
  205. typedef DocRec *DPtr;
  206.  
  207. struct HeaderRec {
  208.   Str255    theFont;
  209.   short        theSize;
  210.   Style     theStyle;
  211.   short     theLength;
  212.   short     numSections;
  213.   short     lastID;
  214. };
  215.  
  216. typedef struct HeaderRec HeaderRec;
  217. typedef HeaderRec *HPtr, **HHandle;
  218.  
  219. #ifndef __COMPGLOBALS__
  220.  
  221. extern short      gWCount;
  222. extern short      gNewDocCount;
  223. extern MenuHandle myMenus[kLastMenu+1];
  224. extern short      gFontMItem;
  225. extern Boolean    gQuitting;
  226. extern Cursor     editCursor;
  227. extern Cursor     waitCursor;
  228. extern Boolean    gInBackground;
  229.   
  230.   /*now for the environment variables set up by Gestalt*/
  231.   
  232. extern Boolean    gGestaltAvailable;
  233. extern Boolean    gAppleEventsImplemented;
  234. extern Boolean    gAliasManagerImplemented;
  235. extern Boolean    gEditionManagerImplemented;
  236. extern Boolean    gOutlineFontsImplemented;
  237. extern Boolean    gRecordingImplemented;
  238. #endif
  239.  
  240. #endif